<?php

class Top100Controller extends Controller
{
	
	public $defaultAction = 'rank';
	
	public function init()
	{
		$this->layout='column1';
	}
	
	/**
	 * Declares class-based actions.
	 */
	public function actions()
	{
		return array(
			// captcha action renders the CAPTCHA image displayed on the contact page
			'captcha'=>array(
				'class'=>'CCaptchaAction',
				'backColor'=>0xFFFFFF,
			),
			// page action renders "static" pages stored under 'protected/views/site/pages'
			// They can be accessed via: index.php?r=site/page&view=FileName
			'page'=>array(
				'class'=>'CViewAction',
			),
		);
	}

	/**
	 * This is the default 'rank' action that is invoked
	 * when an action is not explicitly requested by users.
	 */
	public function actionRank()
	{
		if(!Yii::app()->user->isGuest) {
			$this->render('rank');
		} else {
			$this->redirect(Yii::app()->user->loginUrl);
		}
	}
	

	/**
	 * This is the action to handle external exceptions.
	 */
	public function actionError()
	{
	    if($error=Yii::app()->errorHandler->error)
	    {
	    	if(Yii::app()->request->isAjaxRequest)
	    		echo $error['message'];
	    	else
	        	$this->render('error', $error);
	    }
	}

	/**
	 * Displays the 交通百强县
	 */
	public function actionTransport()
	{
		if(!Yii::app()->user->isGuest) {
			$this->render('transport');
		} else {
			$this->redirect(Yii::app()->user->loginUrl);
		}
	}

	/**
	* Displays the 文化百强县
	*/
	public function actionCulture()
	{
		if(!Yii::app()->user->isGuest) {
			$this->render('culture');
		} else {
			$this->redirect(Yii::app()->user->loginUrl);
		}
	}
	
	/**
	* Displays the 经济百强县
	*/
	public function actionEcnomic()
	{
		if(!Yii::app()->user->isGuest) {
			$this->render('ecnomic');
		} else {
			$this->redirect(Yii::app()->user->loginUrl);
		}
	}
	
	/**
	* Displays the 人才百强县
	*/
	public function actionTalent()
	{
		if(!Yii::app()->user->isGuest) {
			$this->render('talent');
		} else {
			$this->redirect(Yii::app()->user->loginUrl);
		}
	}
}